d2f6245b9a58ba0012826a4754f631e91e6b1db4,src/main/java/uk/co/jemos/podam/typeManufacturers/FloatTypeManufacturerImpl.java,FloatTypeManufacturerImpl,getType,#DataProviderStrategy#AttributeMetadata#Map#,34
Before Change
Float retValue = null;
for (Annotation annotation : attributeMetadata.getAttributeAnnotations()) {
if (PodamFloatValue.class.isAssignableFrom(annotation.getClass())) {
PodamFloatValue floatStrategy = (PodamFloatValue) annotation;
String numValueStr = floatStrategy.numValue();
if (StringUtils.isNotEmpty(numValueStr)) {
try {
retValue = Float.valueOf(numValueStr);
} catch (NumberFormatException nfe) {
String errMsg = PodamConstants.THE_ANNOTATION_VALUE_STR
+ numValueStr
+ " could not be converted to a Float. An exception will be thrown.";
LOG.error(errMsg);
throw new IllegalArgumentException(errMsg, nfe);
}
} else {
float minValue = floatStrategy.minValue();
float maxValue = floatStrategy.maxValue();
// Sanity check
if (minValue > maxValue) {
maxValue = minValue;
}
retValue = getFloatInRange(minValue, maxValue,
attributeMetadata);
}
break;
}
}
if (retValue == null) {
retValue = getFloat(attributeMetadata);
}
After Change
Float retValue;
PodamFloatValue annotationStrategy = findElementOfType(
attributeMetadata.getAttributeAnnotations(), PodamFloatValue.class);
if (null != annotationStrategy) {
String numValueStr = annotationStrategy.numValue();
if (StringUtils.isNotEmpty(numValueStr)) {
try {
retValue = Float.valueOf(numValueStr);
} catch (NumberFormatException nfe) {
throw new IllegalArgumentException(PodamConstants.THE_ANNOTATION_VALUE_STR
+ numValueStr
+ " could not be converted to a Float. An exception will be thrown.",
nfe);
}